import fly from '@/utils/fly'
import appConfig from '@/appConfig'
var api = {
  /**
   * 登录认证
   */
  login: function(workerForm) {
    
    return fly.post('/auth/login', workerForm)
  },
  /**
   *退出登录
   */
  logout: function() {

    return fly.post('/auth/logout')
  },

  wxLogin(openid,loginType) {
    return fly.post('/auth/login', {
      username: openid,
      loginType: loginType
    })
   
  },
  
  getWorkerInfo: function(token) {
    return fly.post('/auth/getUserInfo', { token: token })
  },
  /**
   * 获取微信用户openId v撒的v是地方
   */
  getWxUserInfo: function(code, encryptedData, iv) {
    return fly.post(appConfig.apiUrl + '/getWxUserInfo', {
      code: code,
      encryptedData: encryptedData,
      iv: iv
    })
  }
}

export { api }
